home *** CD-ROM | disk | FTP | other *** search
/ Champak 29 / Volume 29 - JOGO DISK .iso / Games / funny_baseball.swf / scripts / frame_82 / DoAction.as
Text File  |  2006-11-13  |  5KB  |  195 lines

  1. function Check_bat()
  2. {
  3.    if(this.player._x >= 256 && this.player._x < 261.2)
  4.    {
  5.       this.Place = 1;
  6.    }
  7.    else if(this.player._x >= 261.2 && this.player._x < 266.4)
  8.    {
  9.       this.Place = 2;
  10.    }
  11.    else if(this.player._x >= 266.4 && this.player._x < 271.6)
  12.    {
  13.       this.Place = 3;
  14.    }
  15.    else if(this.player._x >= 271.6 && this.player._x < 276.8)
  16.    {
  17.       this.Place = 4;
  18.    }
  19.    else
  20.    {
  21.       this.Place = 5;
  22.    }
  23. }
  24. function Down()
  25. {
  26.    this.onMouseDown = function()
  27.    {
  28.       if(this.Targ._currentframe == 2)
  29.       {
  30.          if(this.Follow)
  31.          {
  32.             this.Hit = true;
  33.             this.player2.FFF = true;
  34.             this.Follow = false;
  35.             this.player.play();
  36.             if(!this.bat_snd)
  37.             {
  38.                SoundObj2.start();
  39.             }
  40.          }
  41.       }
  42.    };
  43. }
  44. function Hit_Ball()
  45. {
  46.    if(this.Hit)
  47.    {
  48.       if(this.bat_hit)
  49.       {
  50.          if(this.player.hit.hitTest(this.player2.ballMC))
  51.          {
  52.             SoundObj1.start();
  53.             this.Hit = false;
  54.             if(this.Check == 1)
  55.             {
  56.                this.Ran = random(2) + 9;
  57.             }
  58.             else if(this.Check == 2)
  59.             {
  60.                this.Ran = random(2) + 16;
  61.             }
  62.             else if(this.Check == 3)
  63.             {
  64.                this.Ran = random(2) + 23;
  65.             }
  66.             else if(this.Check == 5)
  67.             {
  68.                if(this.Place == 1 || this.Place == 2)
  69.                {
  70.                   this.Ran = 15;
  71.                }
  72.                else if(this.Place == 3)
  73.                {
  74.                   this.Ran = 22;
  75.                }
  76.                else
  77.                {
  78.                   this.Ran = 29;
  79.                }
  80.             }
  81.             else
  82.             {
  83.                this.CCC = false;
  84.                this.Ran = 30 + random(3);
  85.             }
  86.             if(this.CCC)
  87.             {
  88.                if(this.Choice == 1)
  89.                {
  90.                   if(this.Place == 1 || this.Place == 2)
  91.                   {
  92.                      this.Ran = this.Ran;
  93.                   }
  94.                   else if(this.Place == 3)
  95.                   {
  96.                      this.Ran += 4;
  97.                   }
  98.                   else
  99.                   {
  100.                      this.Ran += 2;
  101.                   }
  102.                }
  103.                else if(this.Choice == 2)
  104.                {
  105.                   if(this.Place == 1)
  106.                   {
  107.                      this.Ran += 4;
  108.                   }
  109.                   else if(this.Place == 2 || this.Place == 3)
  110.                   {
  111.                      this.Ran += 2;
  112.                   }
  113.                   else
  114.                   {
  115.                      this.Ran = this.Ran;
  116.                   }
  117.                }
  118.                else if(this.Choice == 3)
  119.                {
  120.                   if(this.Place == 1 || this.Place == 2)
  121.                   {
  122.                      this.Ran = this.Ran;
  123.                   }
  124.                   else if(this.Place == 3 || this.Place == 4)
  125.                   {
  126.                      this.Ran += 2;
  127.                   }
  128.                   else
  129.                   {
  130.                      this.Ran += 4;
  131.                   }
  132.                }
  133.                else if(this.Choice == 4)
  134.                {
  135.                   if(this.Place == 1 || this.Place == 2)
  136.                   {
  137.                      this.Ran = 15;
  138.                   }
  139.                   else if(this.Place == 3)
  140.                   {
  141.                      this.Ran = 22;
  142.                   }
  143.                   else
  144.                   {
  145.                      this.Ran = 29;
  146.                   }
  147.                }
  148.             }
  149.             this.player2.ballMc.RX = this.player2.ballMC.ball.ball_in._x;
  150.             this.player2.ballMc.RY = this.player2.ballMC.ball.ball_in._y;
  151.             this.CCC = true;
  152.             this.player2.ballMC.gotoAndStop(this.Ran);
  153.          }
  154.       }
  155.    }
  156. }
  157. this.stop();
  158. this.step = 2;
  159. this.Follow = true;
  160. this.Hit = true;
  161. this.HIHIHI = true;
  162. this.CCC = true;
  163. this.Score = 0;
  164. this.onEnterFrame = function()
  165. {
  166.    if(this.vol == 1)
  167.    {
  168.       soundOn();
  169.       this.vol = 2;
  170.    }
  171.    if(this.vol == 0)
  172.    {
  173.       soundOff();
  174.       this.vol = 2;
  175.    }
  176.    this.txt = this.Score;
  177.    this.Targ._x = this._xmouse;
  178.    this.Targ._y = this._ymouse;
  179.    if(this.Follow)
  180.    {
  181.       this.player._x = this.Targ._x;
  182.    }
  183.    if(this.player._x < 255)
  184.    {
  185.       this.player._x = 256;
  186.    }
  187.    else if(this.player._x > 283)
  188.    {
  189.       this.player._x = 282;
  190.    }
  191.    Check_bat();
  192.    Down();
  193.    Hit_Ball();
  194. };
  195.